<template>
  <div  class="mt30">
    <el-row>
      <el-col :span="24">
        <el-card shadow="hover" style="width: 100%" class="message-main">
          <el-tabs v-model="activeName">
            <el-tab-pane label="系统通知" name="first">
              <el-empty v-if="noticeTotal==0" class="empty" description="暂无消息"></el-empty>
              <el-card v-if="noticeTotal !==0" class="message-main">
                <el-collapse v-if="noticeTotal !=0 " accordion class="student-message-list" >
                  <el-collapse-item v-for="item in noticeTableData" :key="item.id" :name="item.id">
                    <template slot="title">
                      <span style="margin-left: 10%">{{ item.noticeTitle }}</span>
                    </template>
                    <el-divider style="background-color: #1B2B5F"><i class="el-icon-mobile-phone"></i></el-divider>
                    <el-row :gutter="8">
                      <el-col :span="10">
                        <el-tag type="info">
                          <label>发送人：{{ item.remark }}-{{ item.createBy }}</label>
                        </el-tag>
                      </el-col>
                      <el-col :span="10">
                        <el-tag type="info">
                          <label>发送时间：{{ item.createTime }}</label>
                        </el-tag>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="20">
                        <el-tag type="info">
                          <label>发送内容：</label>
                        </el-tag>
                        <div v-html="item.noticeContent" style="opacity: 0.8;width: 100%"></div>
                      </el-col>
                    </el-row>
                  </el-collapse-item>
                </el-collapse>
                <pagination
                  v-show="total1>0"
                  :limit.sync="queryParams1.pageSize"
                  :page.sync="queryParams1.pageNum"
                  :total="total1"
                  @pagination="init"
                />
              </el-card>
            </el-tab-pane>
          </el-tabs>
        </el-card>
      </el-col>
    </el-row>

  </div>
</template>

<script>
import {listNotice} from "@/api/system/notice";

export default {
  name: "pre_in_box",
  data() {
    return {
      //遮罩层
      open: false,
      //消息发送Info
      formInfo: {},
      //自动补全
      restaurants: [],
      //默认标签页
      activeName: "first",
      //普通条数
      messageTotal: 0,
      //学校通知条数
      noticeTotal: 0,
      //学校通知
      noticeTableData: [],
      //普通消息
      total: 0,
      // 普通消息查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
      //学校通知
      total1: 0,
      // 学校通知查询参数
      queryParams1: {
        pageNum: 1,
        pageSize: 10,
      },
    }
  },
  created() {
    this.init()
  },
  watch: {
    $route() {
      this.init()
    }
  },
  methods: {

    //初始化
    init() {
      listNotice(this.queryParams1).then(res => {
        this.total1 = res.total;
        this.noticeTotal = res.total;
        this.noticeTableData = res.rows;
      })
    },


    // 取消按钮
    cancel() {
      this.open = false;
      this.formInfo = {}
    },

  }
}
</script>

<style >
.empty {
  margin-top: 20%;
}

.selectWidth {
  width: 80%;
}
.el-popover{
  background: #1B2B5F !important;
  border-radius: 8px;
  color: #FFFFFF;
}
.pagination-container{
  background: #1B2B5F !important;
}
.message-main{
  width: 100%;
  background: #1B2B5F;
  border-radius: 8px;
  opacity: 0.9;
  min-height: 550px;
}
.el-divider--horizontal{
  color: #1B2B5F !important;
}
</style>
